;
(function() {
	var midEvent = require("./index");
	var emailSender = require("../core/_include/email");
	var notify = require("../server/RESTAPI/notify");
	midEvent.on("bus.new", function(bus_id) {
		var bus = midEvent.Class.Bus.get(bus_id);
		var replyContent = {
			to: bus.info.email,
			title: "您已成功开通多纳微站",
			content: "恭喜您，您已成功开通<b>多纳微站</b>，您的网址：<a href='{url}'>{url}</a>。\n视频教程地址：<a href='{mp4_url}'>{mp4_text}</a>\n如有疑问，请联系客服李小姐：15817330254 ".format({
				url: bus.getOneVisitableUrl(),
				mp4_text: "http://api.dotnar.com/s/ah4li6g0",
				mp4_url: "http://o2oimg.qiniudn.com/点纳微站操作视频教程（4-15）.mp4"
			}),
			files: [{
				filename: bus.info.email.indexOf("@qq.com") !== -1 ? "dotnar guide.pdf" : "多纳微站操作指南.pdf",
				path: __dirname + "/多纳微站操作指南2015-3-31.pdf"
			}]
		};
		console.log("发送邮件到：", bus.info.email);
		emailSender(replyContent, function(error) {
			if (error) {
				console.error("新的订单提示邮件 发送失败", replyContent, error);
			} else {
				console.log("新的订单提示邮件 已经发送");
			}
		});
	});
}());